package com.harmonk.firstscene.db.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
import androidx.room.Delete
import androidx.room.OnConflictStrategy
import com.harmonk.firstscene.db.entity.QuickNote
import kotlinx.coroutines.flow.Flow

@Dao
interface QuickNoteDao {
    @Query("SELECT * FROM quick_notes")
    fun getAllQuickNotes(): Flow<List<QuickNote>>

    @Query("SELECT * FROM quick_notes WHERE quickNoteId = :id")
    suspend fun getQuickNoteById(id: Long): QuickNote?

    @Insert(onConflict = OnConflictStrategy.IGNORE)
    suspend fun insertQuickNote(quickNote: QuickNote): Long

    @Update
    suspend fun updateQuickNote(quickNote: QuickNote)

    @Delete
    suspend fun deleteQuickNote(quickNote: QuickNote)
}